import React from 'react';
import ReactDOM from 'react-dom';
import AsyncApp from './demo/async';
import { ADD, DEL, JQ, doAdd, doDel, async, test } from './model/demo1';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk  from 'redux-thunk'; 

const reduxDevtools = window.devToolsExtension ? window.devToolsExtension():f=>f

const store = createStore(JQ, compose(
  applyMiddleware(thunk),
  reduxDevtools
))

const r = () => {
ReactDOM.render(<AsyncApp store={store} doDel={doDel} />, document.getElementById("root"));
};

r();

store.subscribe(()=>{
    r();
})
store.dispatch(doAdd(2));
store.dispatch(async());
store.dispatch(async());
 
